import Vue from 'vue'
import VueRouter from 'vue-router'

// ---登录注册路由
import Login from '../views/Login/Login.vue'
import Reg from '../views/Reg/Reg.vue'
// 主页面路由
import Home from '../views/Home/Home.vue'

// 主页的儿子
import Welacome from '../views/Home/Welcome.vue'
// 用户信息
import UserInfo from '../views/User/UserInfo.vue'
// 更换头像
import Avatar from '../views/User/UserAvatar.vue'
// 重置密码
import UserPwd from '../views/User/UserPwd.vue'

// --------------------------------
// 文章管理
import Artcate from '../views/Article/Artcate.vue'
// 文章列表
import ArtList from '../views/Article/ArtList.vue'
Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/',
  //   redirect: '/login'
  // },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/reg',
    component: Reg
  },
  {
    path: '/',
    component: Home,
    redircet: '/home',
    children: [
      {
        path: 'home',
        component: Welacome
      }, {
        path: 'user-info',
        component: UserInfo
      },
      {
        path: 'user-avatar',
        component: Avatar
      },
      {
        path: 'user-pwd',
        component: UserPwd
      },
      {
        path: 'art-cate',
        component: Artcate
      },
      {
        path: 'art-list',
        component: ArtList
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
